package com.lhj.xxsc.order.service;

import com.xxsc.common.exception.NoStockExceptoin;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xxsc.common.to.mq.SeckillOrderTo;
import com.xxsc.common.utils.PageUtils;
import com.lhj.xxsc.order.entity.OrderEntity;
import com.lhj.xxsc.order.vo.*;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author leifengyang
 * @email leifengyang@gmail.com
 * @date 2019-10-08 09:56:16
 */
public interface OrderService extends IService<OrderEntity> {

	PageUtils queryPage(Map<String, Object> params);

	/**
	 * 获取订单确认页需要的数据
	 *
	 * @return
	 */
	OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;


	/**
	 * 提交下单信息
	 *
	 * @param vo
	 * @return
	 */
	SubmitOrderResponseVo submitOrder(OrderSubmitVo vo) throws NoStockExceptoin;

	/**
	 * 根据订单号查询订单信息
	 *
	 * @param orderSn
	 * @return
	 */
	OrderEntity getOrderByOrderSn(String orderSn);

	/**
	 * 关闭订单
	 *
	 * @param entity
	 */
	void closeOrder(OrderEntity entity);

	/**
	 * 验证订单号的合法性，获取订单信息
	 *
	 * @param orderSn
	 * @return
	 */
	PayVo getOrderPay(String orderSn);

	PageUtils queryPageWithItem(Map<String, Object> params);

	/**
	 * 接收支付宝支付成功后的异步回调并进行处理
	 *
	 * @param vo
	 * @return
	 */
	String handlePayResult(PayAsyncVo vo);

	/**
	 * 秒杀队列消费者 秒杀
	 *
	 * @param entity
	 */
	void createSeckillOrder(SeckillOrderTo entity);
}

